package exercise;

import java.util.Scanner;

public class EX04_Q35 {
	
	// #35
	
	public static void main(String[] args) {	
		/*int money = 100000;
		int pay = 31210;
		int charge = money - pay;		
		int[] charges = new int[8];
		int[] moneys = {50000, 10000, 5000, 1000, 500, 100, 50, 10};*/
		
		ChargeVO cvo = new ChargeVO();
		Scanner sc = new Scanner(System.in);
		System.out.print("지급액 입력 : ");
		cvo.setMoney(sc.nextInt());		
		System.out.print("가격 입력 : ");
		cvo.setPay(sc.nextInt());
		
		ChargeService.charge(cvo);		
		
		/*for(int i = 0; i <= 7; ++i) {
			charges[i] = charge/moneys[i];
			charge = charge % moneys[i];
			System.out.println(charges[i] + "원권 : " + moneys[i]);
		}*/
		
		/*int W50000 = 0;
		int W10000 = 0;
		int W5000 = 0;
		int W1000 = 0;
		int W500 = 0;
		int W100 = 0;
		int W50 = 0;
		int W10 = 0;*/
		
		/*W50000 = charge/50000;
		charge = charge % 50000;
		System.out.print("5만원 : " + W50000);
			
		W10000 = charge/10000;
		charge = charge % 10000;
		System.out.print("만원 : " + W10000);
				
		W5000 = charge/5000;
		charge = charge % 5000;
		System.out.print("5천원 : " + W5000);
			
		W1000 = charge/1000;
		charge = charge % 1000;
		System.out.print("천원: " + W1000);
			
		W500 = charge/500;
		charge = charge % 500;
		System.out.print("5백원 : " + W500);
				
		W100 = charge/100;
		charge = charge % 100;
		System.out.print("백원 : " + W100);
		
		W50 = charge/50;
		charge = charge % 50;
		System.out.print("오십원 : " + W50);
		
		W10 = charge/10;
		charge = charge % 10;
		System.out.print(" 십원 : " + W10);*/		
		
	}

}


class ChargeVO {
	private int money;
	private int pay;
	private int charge;		
	private int[] charges = new int[8];	
	
	public ChargeVO() {
	}
	
	public ChargeVO(int money, int pay) {
		this.money = money;
		this.pay = pay;	
	}
	
	public void setMoney(int money) {this.money = money;}
	public int getMoney() {return this.money;}
	
	public void setPay(int pay) {this.pay = pay;}
	public int getPay() {return this.pay;}
	
	public void setCharge(int charge) {this.charge = charge;}
	public int getCharge() {return this.charge;}
	
	public void setCharges(int[] charges) {this.charges = charges;}
	public int[] getCharges() {return this.charges;}
}

class ChargeService{
	public static void charge(ChargeVO cvo){
		cvo.setCharge(cvo.getMoney()-cvo.getPay());
		int[] moneys = {50000, 10000, 5000, 1000, 500, 100, 50, 10};
		for(int i = 0; i <= 7; ++i) {
			cvo.getCharges()[i] = cvo.getCharge()/moneys[i];
			cvo.setCharge(cvo.getCharge() % moneys[i]);
			System.out.println(moneys[i] + "원권 : " + cvo.getCharges()[i]);
		}
		cvo.setCharge(cvo.getMoney()-cvo.getPay());
		System.out.println("지급액 : " + cvo.getMoney());
		System.out.println("가격 : " + cvo.getPay());
		System.out.println("거스름 돈 : " + cvo.getCharge());
	}
	
	
	
}



